import { Button, Col, Form, Input, Modal, Row, Table,Select, message, Calendar, Tooltip, Tag, Avatar } from 'antd'
import React, { useEffect, useRef, useState } from 'react'
import { CopyOutlined,CopyrightOutlined ,WhatsAppOutlined,CloseCircleOutlined,FormOutlined} from '@ant-design/icons';
import { baseURL } from '../../../../api/request';
import { roleList } from '../../../../utils';

export default function Yiscore(props: any) {


    const {scoreList,getScoreList}=props
    const columns:any = [
        {
          title: '序号',
          dataIndex: '_v',
          render:(text:any,item:any,index:any)=>{
            return index+1
          },
          align:'center',
          width:'80px'
          
        },   
        {
          title: '头像',
          align:'center' ,
          render(value:any,item:any,index:any){
            return (
              item.avatar?<Avatar src={item.info.avatar.replace(/public/,baseURL)} />:<Avatar src={require('../../../../assets/images/xiaoxin_2.jpg')}></Avatar>
            )
          },
          width:'80px',
          
        }, 
          {
            title:"用户名"  ,
            align:'center' ,
            width:'100px',
            ellipsis:true,
            render(value:any,item:any,index:any){
                return (
                  <p>{item.info.username}</p>
                  
                )
              },
          },
          {
            title:"德育成绩"  ,
            align:'center' ,
            dataIndex:"score",
            width:'100px',
            ellipsis:true
          },
          {
            title:"结果"  ,
            align:'center' ,
            width:'100px',
            ellipsis:true,
            render(value:any,item:any,index:any){
                var msg
                if(item.score<60){
                    msg="不及格"
                }else if(item.score>=60&&item.score<70){
                    msg="及格"
                }else if(item.score>=70&&item.score<80){
                    msg="良好"
                }else {
                    msg="优秀"
                }
                return (
                  <p>{msg}</p>
                )
              },
          },
      ];


  return (
    <div>
       
       <Table dataSource={scoreList} rowKey={record => record._id} columns={columns} pagination={{pageSize:4}} /> 
    </div>
  )
}
